package com.supermap.expertinfo.dao;

import com.supermap.expertinfo.entity.ExpertInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ExpertInfoDao {
    /**
     * 获取某地区前n个活跃的专家列表，并返回活跃度
     * @param count 读取专家信息数量
     * @param areaCode 区域编码
     * @return
     */
    @Select("<script>" +
            "SELECT * FROM t_expertinfo\n" +
            "WHERE del_flg = 0\n" +
            "<if test='areaCodes != null'>\n" +
            "AND areaid IN\n" +
            "<foreach collection='areaCodes' open='(' close=')' item='areaCode' separator=','>\n" +
            "#{areaCode}\n" +
            "</foreach>\n" +
            "</if>" +
            "ORDER BY score DESC\n" +
            "<if test='count != null'>\n" +
            "LIMIT #{count}" +
            "</if>" +
            "</script>")
    public List<ExpertInfo> getPositiveExpertByArea(@Param("count") Integer count, @Param("areaCodes") String[] areaCode);
}
